import React from 'react'
import ReactDOM from 'react-dom'
import { createStore, combineReducers } from 'redux'
import { Provider } from 'react-redux'
import { Router, Route, IndexRoute, browserHistory } from 'react-router'
import { syncHistoryWithStore, routerReducer } from 'react-router-redux'
import * as reducers from '../../src/reducers'

const store = createStore(
  combineReducers({
    ...reducers,
    routing: routerReducer
  })
);
const history = syncHistoryWithStore(browserHistory, store);

function App({ children }) {
  return (
    <div>
      {children}
    </div>
  )
}

class Home extends React.Component {
  render() {
    return (
      <div id="Home">
        石火坚
      </div>
    )
  }
}

let Domain = React.createClass ({
  render() {
    return (
      <div id="Domain">Domain</div>
    )
  }
});


ReactDOM.render(
  <Provider store={store}>
    <div>
      <Router history={history}>
        <Route path="/" component={App}>
          <IndexRoute component={Home}/>
         <Route path="/domain" component={Domain}/>
        </Route>
      </Router>
    </div>
  </Provider>,
  document.getElementById('App')
);
